﻿using System;
using System.Data;

namespace msBsc.WebUi
{
    public partial class wfPageTemplateEditor : msBsc.Cls.BPageHt
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindControls();
                this.SetContrlValue("txtTempUrl", GetFormParam("T_URL"));
                this.ExecJScript("doBoundContent('" + "/Template/" + GetFormParam("T_URL") + "');");
            }
        }
        private void BindControls()
        {
            if (!IsPostBack)
            { 
            }
        }

        private void doSaveSet()
        {
            string strHeadHtml = this.GetPostHtValue("TEMPLATE_HTML");
            string strVpath = "/Template/" + this.GetPostHtValue("TEMPLATE_URL");//只是文件名，目录固定
            if (strHeadHtml != string.Empty && strVpath!=string.Empty)
            { 
                string strFFullPath = System.Web.HttpContext.Current.Server.MapPath(strVpath);
                System.IO.File.WriteAllText(strFFullPath, strHeadHtml, System.Text.Encoding.UTF8);
            }

            this.ExecJScript("layer.msg('成功保存模版！',1,{type:1,shade:false});");

        }
          
        public override void DoAction()
        {
            if (this.strAction == "doSaveSet")
            {
                doSaveSet();
            } 
        }

    }
}